package peluqueria;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.util.Hashtable;
import java.util.List;
import javax.swing.BorderFactory;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.LineBorder;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;

import accesoADatos.AccesoADatos;

import datos.Servicio;

import paneles.PanelServ;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ModifServJdialog extends javax.swing.JDialog {
	private PanelServ panelServ1;
	private JPanel jPanel1;
	private JComboBox jComboBox1;
	private Hashtable hash;

	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame();
				ModifServJdialog inst = new ModifServJdialog(frame);
				inst.setVisible(true);
			}
		});
	}
	
	public ModifServJdialog(JFrame frame) {
		super(frame);
		initGUI();
		List l=AccesoADatos.getInstance().getServicios();
		
	}
	
	private void initGUI() {
		try {
			{
				panelServ1 = new PanelServ();
				getContentPane().add(panelServ1, BorderLayout.SOUTH);
			}
			{
				jPanel1 = new JPanel();
				FlowLayout jPanel1Layout = new FlowLayout();
				jPanel1Layout.setHgap(10);
				jPanel1Layout.setVgap(10);
				jPanel1.setLayout(jPanel1Layout);
				getContentPane().add(jPanel1, BorderLayout.CENTER);
				jPanel1.setPreferredSize(new java.awt.Dimension(392, 46));
				{
					ComboBoxModel jComboBox1Model = 
						new DefaultComboBoxModel(
								new String[] { "Item One", "Item Two" });
					jComboBox1 = new JComboBox();
					jPanel1.add(jComboBox1);
					jComboBox1.setModel(jComboBox1Model);
					jComboBox1.setPreferredSize(new java.awt.Dimension(200, 21));
					jComboBox1.setBackground(new java.awt.Color(255,255,255));
					Servicio s=(Servicio)this.hash.get(this.jComboBox1.getSelectedItem());
					this.panelServ1.setServicio(s);
					jComboBox1.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
					jComboBox1.addPopupMenuListener(new PopupMenuListener() {
						public void popupMenuWillBecomeVisible(PopupMenuEvent evt) {
							//TODO add your code for jComboBox1.popupMenuWillBecomeVisible
						}
						public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) {
							jComboBox1PopupMenuWillBecomeInvisible(evt);
						}
						public void popupMenuCanceled(PopupMenuEvent evt) {
							//TODO add your code for jComboBox1.popupMenuCanceled
						}
					});
				}
			}
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	protected void jComboBox1PopupMenuWillBecomeInvisible(PopupMenuEvent evt) {
		Servicio s=(Servicio)this.hash.get(this.jComboBox1.getSelectedItem());
		this.panelServ1.setServicio(s);
		
	}

}
